package com.lu.action;

import java.util.HashMap;
import java.util.Map;

import com.lu.entity.User;
import com.lu.service.UserService;
import com.opensymphony.xwork2.ActionSupport;

public class DoLoginAction extends ActionSupport{
	
	UserService userService = new UserService();
	
	private Long id;
	private String username;
	private String password;
	private String phoneNO;

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public String execute() throws Exception{
		System.out.println("doLogin");
		System.out.println(username+"="+password);
		Map<String,Object> map = new HashMap<>();
		map.put("username", username);
		map.put("password", password);
		User user = userService.getUser(map);
		if(user==null){
			return "error";
		}
		return "success";
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPhoneNO() {
		return phoneNO;
	}

	public void setPhoneNO(String phoneNO) {
		this.phoneNO = phoneNO;
	}

}
